; $VER: Premiere Floppy & CD32 HD Install-Script V1.1 by Jean-Francois Fabre


;try to figure out a place where the user usually installs his games
(if (exists "Games:" (noreq) )
    (set @default-dest "Games:")
    (if (exists "SYS:Games" (noreq) )
        (set @default-dest "SYS:Games")
        (if (exists "Work:Games" (noreq) )
            (set @default-dest "Work:Games")
            (if (exists "JEUX:" (noreq) )
               (set @default-dest "JEUX:")
               (set @default-dest "SYS:")
            )
        )
    )
)

(set GameDir "Premiere")

(set #game_ver
	(askchoice
		(prompt ("Which version of %s\ndo you want to install" @app-name))
		(help	@askoptions-help)
		(choices
		   "CD-32 version"
		   "Floppy version"
		)
	)
)

;ask the user to select a directory to install the game into
(set default-dest
     (tackon (askdir (prompt "Where would you like " @app-name " installed?\n"
                             "A drawer called " GameDir " will be created.")
                     (help @askdir-help)
                     (default @default-dest)
             )
     GameDir
     )
)
(set @default-dest default-dest)

(message "\n\n\nThis loader needs the JST program (NOT INCLUDED)\n to be copied in your path\n\n(if you don't have it already)\n\nJST is available from aminet (game/patch) or on my site")

;	create the selected directory
(makedir @default-dest
         (infos)
)


	;copy all extra files to this directory

        (copyfiles (source "premierehd.readme")
                   (dest @default-dest)
		   (infos)
        )

        (copyfiles (source "prem_abs")
                   (dest @default-dest)
        )

        (copyfiles (source "Prem32HD")
                   (dest @default-dest)
		   (infos)
        )

(if (= #game_ver 0)
    (
        (message "\n\n\n\n\n\nPlease insert Premiere CD-ROM in any drive")

        (copyfiles (source "CD0:premiere")
                   (dest @default-dest)
		   (all)
        )
   )
)


(if (= #game_ver 1)
    (

(set #CI_unit
	(askchoice
		(prompt "From which disk unit do you want\nto install the game")
		(help	@askoptions-help)
		(choices
		   "DF0:"
		   "DF1:"
		   "DF2:"
		   "DF3:"
		)
	)
)

(set #CI_drive ("DF%ld:" #CI_unit))


	(message ("\nInsert %s disk 1 into drive %s !" @app-name #CI_drive))
	(if
		(= 0 (run ("ripcorefiles %ld \"%s\" B41CFF7D >con:///1000//CLOSE/WAIT" #CI_unit default-dest )))
		("")
		(abort "\"ripcorefiles\" must be in your PATH !")
	)

	(message ("\nInsert %s disk 2 into drive %s !" @app-name #CI_drive))
	(if
		(= 0 (run ("ripcorefiles %ld \"%s\" ECF4E3E9 >con:///1000//CLOSE/WAIT" #CI_unit default-dest )))
		("")
		(abort "\"ripcorefiles\" must be in your PATH !")
	)

	(message ("\nInsert %s disk 3 into drive %s !" @app-name #CI_drive))
	(if
		(= 0 (run ("ripcorefiles %ld \"%s\" A5481890 >con:///1000//CLOSE/WAIT" #CI_unit default-dest )))
		("")
		(abort "\"ripcorefiles\" must be in your PATH !")
	)


)
)
